﻿namespace OnlineVideos.RingToneEditor
{
    using System;
    using System.IO;
    using System.Runtime.InteropServices;

    //[StructLayout(LayoutKind.Sequential, Pack=2)]
    public class WaveFormatExtraData : WaveFormat
    {
        [MarshalAs(UnmanagedType.ByValArray, SizeConst=100)]
        private byte[] extraData;
        public byte[] ExtraData
        {
            get
            {
                return this.extraData;
            }
        }
        internal WaveFormatExtraData()
        {
            this.extraData = new byte[100];
        }

        public WaveFormatExtraData(BinaryReader reader) : base(reader)
        {
            this.extraData = new byte[100];
            this.ReadExtraData(reader);
        }

        internal void ReadExtraData(BinaryReader reader)
        {
            if (base.extraSize > 0)
            {
                reader.Read(this.extraData, 0, base.extraSize);
            }
        }

        public override void Serialize(BinaryWriter writer)
        {
            base.Serialize(writer);
            if (base.extraSize > 0)
            {
                writer.Write(this.extraData, 0, base.extraSize);
            }
        }
    }
}

